/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dilean.impl.model;

import java.util.Collection;
import java.util.HashSet;

import com.dilean.api.model.AttributeList;
import com.dilean.api.model.AttributeListValue;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "ATTR_LISTS")
public class AttributeListImpl extends AbstractEntityImpl implements AttributeList 
{
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "DILEAN_ID_SEQ")
    @SequenceGenerator(name = "DILEAN_ID_SEQ", sequenceName = "DILEAN_ID_SEQ", allocationSize = 1)
    @Column(name = "ID")
    private Integer id;

    @Column(name = "NAME", unique = false, nullable = false)
    private String name;

    @Override
    public Integer getId()
    {
        return id;
    }

    @Override
    public String getName()
    {
        return name;
    }

    @Override
    public void setId(Integer id)
    {
        this.id = id;
    }

    @Override
    public void setName(String name)
    {
        this.name = name;
    }
    
    @Column(name = "DESCRIPTION", unique = false, nullable = true)
    private String description;
    
    @Override
    public String getDescription() 
    {
        return description;    
    }

    @Override
    public void setDescription(String description) 
    {
        this.description = description;
    }
    
    @OneToMany(targetEntity = AttributeListValueImpl.class, mappedBy = "attrList")
    private Collection<AttributeListValue> attributeListValues = new HashSet<AttributeListValue>();
    
    @Override
    public Collection<AttributeListValue> getAttributeListValues() 
    {
        return attributeListValues;    
    }
    
    @Override
    public void setAttributeListValues(Collection<AttributeListValue> attributeListValues) 
    {
        this.attributeListValues = attributeListValues;
    }

}
